package com.yupi.yuoj.model.vo;

import com.yupi.yuoj.model.entity.CommentLike;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * 评论点赞视图
 *
 * @author jingjin
 */
@Data
public class CommentLikeVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 评论 id
     */
    private Long commentId;

    /**
     * 用户 id
     */
    private Long userId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 评论信息
     */
    private ContentCommentVO comment;

    /**
     * 用户信息
     */
    private UserVO user;

    /**
     * 包装类转对象
     *
     * @param commentLikeVO
     * @return
     */
    public static CommentLike voToObj(CommentLikeVO commentLikeVO) {
        if (commentLikeVO == null) {
            return null;
        }
        CommentLike commentLike = new CommentLike();
        BeanUtils.copyProperties(commentLikeVO, commentLike);
        return commentLike;
    }

    /**
     * 对象转包装类
     *
     * @param commentLike
     * @return
     */
    public static CommentLikeVO objToVo(CommentLike commentLike) {
        if (commentLike == null) {
            return null;
        }
        CommentLikeVO commentLikeVO = new CommentLikeVO();
        BeanUtils.copyProperties(commentLike, commentLikeVO);
        return commentLikeVO;
    }

    private static final long serialVersionUID = 1L;
}